"""
课堂练习
"""
def main():
    """主函数(程序入口)"""
    i = True
    list1 = []
    nums = input('请输入一个数字')
    sum1 = int(nums)
    list1.append(sum1)
    while i:
        sum2 = 0
        for num in str(sum1):
            sum2 += int(num)**2
        sum1 = sum2
        if sum1 == 1:
            print('是快乐数')
            i = False
        elif sum1 in list1:
            print('不是快乐数')
            i = False
        list1.append(sum1)
if __name__ == '__main__':
    main()
